﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VNPT.Excel;

namespace VNPT.DoiSoat.DoiSoat
{
    public partial class uVietTel : VNPT.Core.uBase
    {
        public uVietTel()
        {
            InitializeComponent();

        }

        public override void SaveSetting()
        {
            DoiSoatSetting.DS_178Viettel_QuocTe = mySQLEditor_QuocTe.Text;
            DoiSoatSetting.DS_178Viettel_TrongNuoc = mySQLEditor_TrongNuoc.Text;

            base.SaveSetting();
        }
        public override void LoadSetting()
        {
            mySQLEditor_QuocTe.Text = DoiSoatSetting.DS_178Viettel_QuocTe;
            mySQLEditor_TrongNuoc.Text = DoiSoatSetting.DS_178Viettel_TrongNuoc;
            base.LoadSetting();
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            using (new DevExpress.Utils.WaitDialogForm("Vui lòng chờ..."))
            {
                string sql = "";
                if (this.xtraTabControl1.SelectedTabPage == xtraTabPage1)
                {
                    sql = mySQLEditor_QuocTe.Text;
                }
                else
                {
                    sql = mySQLEditor_TrongNuoc.Text;
                }
                sql = string.Format(sql, DoiSoatSetting.NAM, DoiSoatSetting.THANG);
                myGridControl1.DataSource = DbServer.GetDataSet(new Data.QueryCommandConfig(sql)).Tables[0];
            }
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            this.SaveSetting();
        }
    }
}
